package com.android.functionmanagement.ui;

import android.os.Bundle;
import android.widget.TextView;

import com.android.functionmanagement.BaseActivity;
import com.android.functionmanagement.globle.ConstantGloble;
import com.android.functionmanagement.util.DeviceUtils;
import com.android.functionmanagement.util.SharedPreferencesUtils;
import com.uwatch.helowin.R;

public class UserInfoActivity extends BaseActivity {
	private TextView userNameView, userIDView;
	private String userName, userID;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.userinfo_layout);
		setupViews();
		((TextView) findViewById(R.id.dev_imei))
				.setText(getString(R.string.user_imei) + ":"
						+ DeviceUtils.getIMEI(this));
		updateDisplayData();
	}

	protected void updateDisplayData() {
		getUserInfo();
		userNameView.setText(getString(R.string.user_name) + ":" + userName);
		userIDView.setText(getString(R.string.user_id) + ":" + userID);
	}

	private void getUserInfo() {
		userName = SharedPreferencesUtils.getParam(this,
				ConstantGloble.USERNAME, "").toString();
		userID = SharedPreferencesUtils.getParam(this, ConstantGloble.USERID,
				"").toString();
	}

	private void setupViews() {
		userNameView = (TextView) findViewById(R.id.userName);
		userIDView = (TextView) findViewById(R.id.userId);
	}
}
